﻿var url;
function updateRequireProjects() {
    var allInputs = document.getElementsByTagName("input");
    var sb = "";
    for (i = 0; i < allInputs.length; i++) {
        if (allInputs[i].checked) {
            sb += allInputs[i].value + ";";
        }
    }
    url = "../../BusinessTier/Handlers/RequiredItemsHandler.ashx?action=Set&val=" + sb;
    $.get(url, function (data) {
        //alert(data);
        $.messager.alert("必填字段设置提示",data);
    });
}

function setRegisterDate() {
    var day = document.getElementById("txtRegisterTime").value;
    url = "../../BusinessTier/HandlersSetRegisterDate.ashx?d=" + day;
    $.get(url, function (data) {
        alert(data);
    });
}

window.onload = function () {
    url = "../../BusinessTier/Handlers/RequiredItemsHandler.ashx?action=Get";
    $.get(url, function (data) {
        if (data != "") {
            var lists = data.split(';');
            for (var i = 0; i < lists.length; i++) {
                var chbInput = document.getElementsByName(lists[i])[0];
                if (chbInput.type == "checkbox") {
                    chbInput.checked = true;
                }
            }
        }
    });

    url = "../../Handlers/OtherHanders/GetRequiredFromFile.ashx?type=register";
    $.get(url, function (myData) {
        var txtRegisterTime = document.getElementById("txtRegisterTime");
        txtRegisterTime.setAttribute("value", myData);
    });

}